package com.example.demo.controller.layui;

import com.example.demo.componet.ReadCSVToBean;
import com.example.demo.model.LayuiPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@PropertySource("classpath:file.properties")
@RestController
@CrossOrigin
@RequestMapping("/layui")
public class ShowDataController {

    @Autowired
    String getFilePath;


    @GetMapping("/showdata")
    public LayuiPage getLayuiPage(){
        ReadCSVToBean csvToBean = new ReadCSVToBean();
        LayuiPage layuiPage = csvToBean.getLayuiPage(getFilePath);
        return layuiPage;
    }
}
